package cn.opopopo.design_pattern_learn.结构型.decorator.demo1;

public class Main {
    public static void main(String[] args) {
        // 基础咖啡
        Coffee coffee = new SimpleCoffee();
        System.out.println(coffee.getDescription() + " - $" + coffee.cost());

        // 加牛奶
        coffee = new MilkDecorator(coffee);
        System.out.println(coffee.getDescription() + " - $" + coffee.cost());

        // 再加糖
        coffee = new SugarDecorator(coffee);
        System.out.println(coffee.getDescription() + " - $" + coffee.cost());

        // 输出：
        // Simple Coffee - $2.0
        // Simple Coffee, Milk - $3.0
        // Simple Coffee, Milk, Sugar - $3.5
    }
}